<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>修改商品信息</title>
<link rel="stylesheet" href="${pageContext.request.contextPath }/statics/css/bootstrap.css"/>
<link rel="stylesheet" href="${pageContext.request.contextPath }/statics/css/1.css"/>
<script type="text/javascript" src="${pageContext.request.contextPath}/statics/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript">
	function login(){
		location.href="${pageContext.request.contextPath }/devApp/disLogin";
	}
	 function checkUsername(obj){
		//获得用户输入的用户名
		//var username = obj.value;
		var username = $(obj).val();
		
		$.ajax({
			url:"${pageContext.request.contextPath }/devApp/checkUsername",
			type:"POST",
			data:"{\"username\":\""+username+"\"}",
			success:function(data){
				alert(data.id);
				if(data.id > 0){
					$("#usernameInfo").html("用户名已经存在");
					$("#usernameInfo").css("color","red");
				}else{
					$("#usernameInfo").html("用户名可以使用");
					$("#usernameInfo").css("color","green");
				}
			},
			datatype:"json",
			contentType:"application/json;charset=utf-8"
		});
		
		
	} 
	//发送手机验证码
	function sendSMS(){
		//获得用户输入的手机号
		var	phoneNumber= $("#phoneNumber").val();
		$.ajax({
			url:"${pageContext.request.contextPath}/devApp/register",
			type:"post",
			data:"phoneNumber="+phoneNumber,
			success:function(data){
				
			
			
			},
			datatype:"text"
		
		});
	
	
	
	}
</script>
</head>
<body> 
<div class="page-header">
    <h1>注册账号</h1>
</div>
<form id="zhuce" action="${pageContext.request.contextPath }/devUser/register" method="post">
	
    <h1 style="color:red">${registerInfo }</h1>
    <div class="form-group">
        <label for="ename">用户名:</label>
        <input type="text" class="form-control" onblur="checkUsername(this)" name="devcode" id="ename" placeholder="请输入用户名">
        <span id="usernameInfo"></span>
    </div>
    <div class="form-group">
        <label for="pwd">密码:</label>
        <input type="password" class="form-control" onblur="checkPassword()" name="devpassword" id="pwd" placeholder="请输入密码">
         <span id="checkPasswordInfo"></span>
    </div>
    <span id="passwordReadly"></span>
    <div class="form-group">
        <label for="qpwd">确认密码:</label>
        <input type="password" class="form-control" onblur="checkPassword()" name="devpassword2" id="qpwd" placeholder="请再次输入密码">
    </div>
     <div class="form-group">
        <label for="phoneNumber">手机号:</label>
        <input type="text" class="form-control"  name="phoneNumber" id="phoneNumber" placeholder="请输入手机验证码 ">
   	
    </div>
     <div class="form-group">
        <label for="qpwd">手机验证码:</label>
        <input type="text" class="form-control"  name="phoneCode" id="phoneCode" placeholder="请输入手机验证码 ">
   		<input type="button" onclick="sendSMS()" class="btn btn-success" value="发送验证码"/>
    </div>
    <button type="submit" class="btn btn-primary">注册</button>
    <a href="javascript:;" onclick="login()" class="btn btn-success">跳转登录</a>
</form>
</body>

</html>